var Cookie = {
  set: function(name, value, daysToExpire) {
    var expire = '';
    if (daysToExpire != undefined) {
      var d = new Date();
      d.setTime(d.getTime() + (86400000 * parseFloat(daysToExpire)));
      expire = '; expires=' + d.toGMTString();
    }
    return (document.cookie = escape(name) + '=' + escape(value || '') + expire);
  },
  get: function(name) {
    var cookie = document.cookie.match(new RegExp('(^|;)\\s*' + escape(name) + '=([^;\\s]*)'));
    return (cookie ? unescape(cookie[2]) : null);
  },
  erase: function(name) {
    var cookie = Cookie.get(name) || true;
    Cookie.set(name, '', -1);
    return cookie;
  },
  accept: function() {
    if (typeof navigator.cookieEnabled == 'boolean') {
      return navigator.cookieEnabled;
    }
    Cookie.set('_test', '1');
    return (Cookie.erase('_test') === '1');
  }
};

var Page = new Base("Page", "http://ias.lab01.openmaru.com:10015", "page", "pages");

var RequestParam = {
    getValue: function(name) {
        var queryString = window.top.location.search.substring(1);
        var parameterName = name + "=";
        if ( queryString.length > 0 ) {
            var begin = queryString.indexOf ( parameterName );
            if ( begin != -1 ) {
                begin += parameterName.length;
                end = queryString.indexOf ( "&" , begin );
                if ( end == -1 ) {
                    end = queryString.length
                }
                return unescape ( queryString.substring ( begin, end ) );
            }
            return "null";
        }
    }
};